package com.yiwenup.leetcode.daily;

import java.util.Arrays;

/**
 * 文件描述
 *
 * @Project struct-algorithm
 * @Package com.yiwenup.leetcode.daily
 * @Author yiwenup
 * @Date 2024-12-13 19:06:42
 * @Description https://leetcode.cn/problems/final-array-state-after-k-multiplication-operations-i/description/?envType=daily-question&envId=2024-12-13
 */
public class No3264 {
    public int[] getFinalState(int[] nums, int k, int multiplier) {
        while(k > 0) {
            int idx = 0;
            for(int i = 1; i < nums.length; i++) {
                if(nums[i] < nums[idx]) {
                    idx = i;
                }
            }
            nums[idx] *= multiplier;
            k--;
        }

        return nums;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{2, 1, 3, 5, 6};
        int[] res = new No3264().getFinalState(nums, 5, 2);
        System.out.println(Arrays.toString(res));
    }
}
